#!/usr/bin/env bash



echo "更新yum源"
sudo yum update

echo "卸载老版本docker"
sudo yum remove docker  docker-common docker-selinux docker-engine

echo "安装device-mapper,lvm2,yum-utils"
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

echo "配置docker-yum仓库"
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

echo "安装最新版本的docker"
sudo yum install docker-ce

echo "启动docker"
sudo systemctl start docker

echo "开机自启动docker"
sudo systemctl enable docker

echo "验证docker是否安装成功！"
docker version

echo "详细信息请查看https://www.cnblogs.com/yufeng218/p/8370670.html"